package com.github.binarywang.demo.wx.mp.jpa;

import com.github.binarywang.demo.wx.mp.beans.WxMultiConfigDto;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author xiaoban
 * @date 2021/9/2 下午9:45
 */
@Repository
@EnableJpaRepositories(basePackages = "com.github.binarywang.demo.wx.mp.beans.WxMultiConfigDto")
public interface MerchantsConfigDao extends JpaRepository<WxMultiConfigDto,Long> {
    @Query(value = "select * from gzh where status='available' and appid not in ( " +  //status为1表示可用，0表示禁用
        "select app_id from focus_info where wx_mp_user_id in ?1)",nativeQuery = true)
    List<WxMultiConfigDto> findNoAttention(List<Long> wxUserId);
}
